﻿function WML_CT_Fonts() {
    this.hint = "";
    this.ascii = "";
    this.hAnsi = "";
    this.eastAsia = "";
    this.cs = "";
    this.asciiTheme = "";
    this.hAnsiTheme = "";
    this.eastAsiaTheme = "";
    this.cstheme = "";
}

function WML_CT_Color() {
    this.val = "";
    this.themeColor = "";
    this.themeTint = "";
    this.themeShade = "";
}

function WML_CT_Shd() {
    this.val = "";
    this.color = "";
    this.themeColor = "";
    this.themeTint = "";
    this.themeShade = "";
    this.fill = "";
    this.themeFill = "";
    this.themeFillTint = "";
    this.themeFillShade = "";
}

function WML_CT_RPr() {
    this.rStyle = "";
    this.rFonts = new WML_CT_Fonts();
    this.b = false;
    this.bCs = false;
    this.i = false;
    this.iCs = false;
    this.caps = false;
    this.smallCaps = false;
    this.strike = false;
    this.dstrike = false;
    this.outline = false;
    this.shadow = false;
    this.emboss = false;
    this.imprint = false;
    this.noProof = false;
    this.snapToGrid = false;
    this.vanish = false;
    this.webHidden = false;
    this.color = new WML_CT_Color();
    this.spacing = "";
    this.w = "";
    this.kern = "";
    this.position = "";
    this.sz = "";
    this.szCs = "";
    this.highlight = "";
    this.u = "";
    this.effect = "";
    this.bdr = new WML_CT_Border();
    this.shd = new WML_CT_Shd();
    this.fitText = new WML_CT_FitText();
    this.vertAlign = "";
    this.rtl = false;
    this.cs = false;
    this.em = "";
    this.lang = new WML_CT_Language();
    this.eastAsianLayout = new WML_CT_EastAsianLayout();
    this.specVanish = false;
    this.oMath = false;
}

function WML_CT_EastAsianLayout() {
    this.id = "";
    this.combine = false;
    this.combineBrackets = "";
    this.vert = false;
    this.vertCompress = false;
}

function WML_CT_Language() {
    this.val = "";
    this.eastAsia = "";
    this.bidi = "";
}

function WML_CT_FitText() {
    this.val = "";
    this.id = "";
}

function WML_CT_Style() {
    this.name = "";
    this.aliases = "";
    this.basedOn = "";
    this.next = "";
    this.link = "";
    this.autoRedefine = false;
    this.hidden = false;
    this.uiPriority = 0;
    this.semiHidden = false;
    this.unhideWhenUsed = false;
    this.qFormat = false;
    this.locked = false;
    this.personal = false;
    this.personalCompose = false;
    this.personalReply = false;
    this.rsid = 0;
    this.pPr = new WML_CT_PPrGeneral();
    this.rPr = new WML_CT_RPr();
    this.tblPr = new WML_CT_TblPrBase();
    this.type = "";
    this.styleId = "";
    this._default = false;
    this.customStyle = false;
}

function WML_CT_TblPPr() {
    this.leftFromText = "";
    this.rightFromText = "";
    this.topFromText = "";
    this.bottomFromText = "";
    this.vertAnchor = "";
    this.horzAnchor = "";
    this.tblpXSpec = "";
    this.tblpX = "";
    this.tblpYSpec = "";
    this.tblpY = "";
}
function WML_CT_TblWidth() {
    this.w = "";
    this.type = "";
}
function WML_CT_TblBorders() {
    this.top = new WML_CT_Border();
    this.start = new WML_CT_Border();
    this.bottom = new WML_CT_Border();
    this.end = new WML_CT_Border();
    this.insideH = new WML_CT_Border();
    this.insideV = new WML_CT_Border();
}
function WML_CT_TblPrBase() {
    this.tblStyle = "";
    this.tblpPr = null;
    this.tblOverlap = "";
    this.bidiVisual = false;
    this.tblStyleRowBandSize = "";
    this.tblStyleColBandSize = "";
    this.tblW = new WML_CT_TblWidth();
    this.jc = "";
    this.tblCellSpacing = new WML_CT_TblWidth();
    this.tblInd = new WML_CT_TblWidth();
    this.tblBorders = new WML_CT_TblBorders();
    this.shd = new WML_CT_Shd();
    this.tblLayout = "";
    this.tblCellMar = new WML_CT_TblCellMar();
    this.tblLook = new WML_CT_TblLook();
    this.tblCaption = "";
    this.tblDescription = "";
}
function WML_CT_TblLook() {
    this.firstRow = false;
    this.lastRow = false;
    this.firstColumn = false;
    this.lastColumn = false;
    this.noHBand = false;
    this.noVBand = false;
}
function WML_CT_TblCellMar() {
    this.top = new WML_CT_TblWidth();
    this.start = new WML_CT_TblWidth();
    this.bottom = new WML_CT_TblWidth();
    this.end = new WML_CT_TblWidth();
}

function WML_CT_TblCellMar() {
    this.top = new WML_CT_TblWidth();
    this.start = new WML_CT_TblWidth();
    this.bottom = new WML_CT_TblWidth();
    this.end = new WML_CT_TblWidth();
}

function WML_CT_Selection() {
    this.StartingParagraph = null;
    this.StartingPage = null;
    this.StartingRun = null;
    this.StartingLocation = null;
    this.Runs = new Array();
    this.Pages = new Array();
    this.Paragraphs = new Array();
    this.Spans = new Array();
    this.EndingParagraph = null;
    this.EndingPage = null;
    this.EndingRun = null;
    this.EndingLocation = null;
}



function WML_CT_Settings() {
    this.Classname = function () { return "WML_CT_Settings" };
    this.ZoomChangingInternal = function (sender, oldVal, newVal) { }
    var _ZoomChangingSubscribers = new Array();
    this.AddZoomChangingSubscriber = function (fun) { this._ZoomChangingSubscribers.push(fun); }
    this.RemoveZoomChangingSubscriber = function (fun) { this._ZoomChangingSubscribers.pop(fun); }
    this.ZoomChangedInternal = function (sender, oldVal, newVal) { }
    var _ZoomChangedSubscribers = new Array();
    this.AddZoomChangedSubscriber = function (fun) { this._ZoomChangedSubscribers.push(fun); }
    this.RemoveZoomChangedSubscriber = function (fun) { this._ZoomChangedSubscribers.pop(fun); }

    var _Zoom = "100";
    this.Zoom = function (value) {
        if (value == null) {
            return _Zoom;
        }
        if (!value.toString().match(/-?[0-9]+(\.[0-9]+)?%/)) { throw "" }
        this.ZoomChangingInternal(this, _Zoom, value);
        var cont = true;
        for (var i in this._ZoomChangingSubscribers) {
            cont = i(this, _Zoom, value);
        }
        if (cont) {
            _Zoom = value;
            this.ZoomChangedInternal(this, _Zoom, value);
            for (var i in this._ZoomChangedSubscribers) {
                i(this, _Zoom, value);
            }
        }
    }
}

function WML_CT_PageMar() {
    this.Classname = function () { return "WML_CT_PageMar" };

    this.TopChangingInternal = function (sender, oldVal, newVal) {
    }
    var _TopChangingSubscribers = new Array();
    this.AddTopChangingSubscriber = function (fun) { this._TopChangingSubscribers.push(fun); }
    this.RemoveTopChangingSubscriber = function (fun) { this._TopChangingSubscribers.pop(fun); }
    this.TopChangedInternal = function (sender, oldVal, newVal) { }
    var _TopChangedSubscribers = new Array();
    this.AddTopChangedSubscriber = function (fun) { this._TopChangedSubscribers.push(fun); }
    this.RemoveTopChangedSubscriber = function (fun) { this._TopChangedSubscribers.pop(fun); }

    var _Top = "1440";
    this.Top = function (value) {
        if (value == null) {
            return _Top;
        }
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.TopChangingInternal(this, _Top, value);
        var cont = true;
        for (var i in this._TopChangingSubscribers) {
            cont = i(this, _Top, value);
        }
        if (cont) {
            _Top = value;
            this.TopChangedInternal(this, _Top, value);
            for (var i in this._TopChangedSubscribers) {
                i(this, _Top, value);
            }
        }
    }

    this.RightChangingInternal = function (sender, oldVal, newVal) { }
    var _RightChangingSubscribers = new Array();
    this.AddRightChangingSubscriber = function (fun) { this._RightChangingSubscribers.push(fun); }
    this.RemoveRightChangingSubscriber = function (fun) { this._RightChangingSubscribers.pop(fun); }
    this.RightChangedInternal = function (sender, oldVal, newVal) { }
    var _RightChangedSubscribers = new Array();
    this.AddRightChangedSubscriber = function (fun) { this._RightChangedSubscribers.push(fun); }
    this.RemoveRightChangedSubscriber = function (fun) { this._RightChangedSubscribers.pop(fun); }

    var _Right = "1440";
    this.Right = function (value) {
        if (!ST_SignedTwipsMeasure.IsValid(value)) { throw "" }
        this.RightChangingInternal(this, _Right, value);
        var cont = true;
        for (var i in this._RightChangingSubscribers) {
            cont = i(this, _Right, value);
        }
        if (cont) {
            _Right = value;
            this.RightChangedInternal(this, _Right, value);
            for (var i in this._RightChangedSubscribers) {
                i(this, _Right, value);
            }
        }
    }

    this.BottomChangingInternal = function (sender, oldVal, newVal) { }
    var _BottomChangingSubscribers = new Array();
    this.AddBottomChangingSubscriber = function (fun) { this._BottomChangingSubscribers.push(fun); }
    this.RemoveBottomChangingSubscriber = function (fun) { this._BottomChangingSubscribers.pop(fun); }
    this.BottomChangedInternal = function (sender, oldVal, newVal) { }
    var _BottomChangedSubscribers = new Array();
    this.AddBottomChangedSubscriber = function (fun) { this._BottomChangedSubscribers.push(fun); }
    this.RemoveBottomChangedSubscriber = function (fun) { this._BottomChangedSubscribers.pop(fun); }

    var _Bottom = "1440";
    this.Bottom = function (value) {
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.BottomChangingInternal(this, _Bottom, value);
        var cont = true;
        for (var i in this._BottomChangingSubscribers) {
            cont = i(this, _Bottom, value);
        }
        if (cont) {
            _Bottom = value;
            this.BottomChangedInternal(this, _Bottom, value);
            for (var i in this._BottomChangedSubscribers) {
                i(this, _Bottom, value);
            }
        }
    }

    this.LeftChangingInternal = function (sender, oldVal, newVal) { }
    var _LeftChangingSubscribers = new Array();
    this.AddLeftChangingSubscriber = function (fun) { this._LeftChangingSubscribers.push(fun); }
    this.RemoveLeftChangingSubscriber = function (fun) { this._LeftChangingSubscribers.pop(fun); }
    this.LeftChangedInternal = function (sender, oldVal, newVal) { }
    var _LeftChangedSubscribers = new Array();
    this.AddLeftChangedSubscriber = function (fun) { this._LeftChangedSubscribers.push(fun); }
    this.RemoveLeftChangedSubscriber = function (fun) { this._LeftChangedSubscribers.pop(fun); }


    var _Left = "1440";
    this.Left = function (value) {
        if (value == null) {
            return _Left;
        }
        if (!ST_SignedTwipsMeasure.IsValid(value)) { throw "" }
        this.LeftChangingInternal(this, _Left, value);
        var cont = true;
        for (var i in this._LeftChangingSubscribers) {
            cont = i(this, _Left, value);
        }
        if (cont) {
            _Left = value;
            this.LeftChangedInternal(this, _Left, value);
            for (var i in this._LeftChangedSubscribers) {
                i(this, _Left, value);
            }
        }
    }

    this.HeaderChangingInternal = function (sender, oldVal, newVal) { }
    var _HeaderChangingSubscribers = new Array();
    this.AddHeaderChangingSubscriber = function (fun) { this._HeaderChangingSubscribers.push(fun); }
    this.RemoveHeaderChangingSubscriber = function (fun) { this._HeaderChangingSubscribers.pop(fun); }
    this.HeaderChangedInternal = function (sender, oldVal, newVal) { }
    var _HeaderChangedSubscribers = new Array();
    this.AddHeaderChangedSubscriber = function (fun) { this._HeaderChangedSubscribers.push(fun); }
    this.RemoveHeaderChangedSubscriber = function (fun) { this._HeaderChangedSubscribers.pop(fun); }


    var _Header = "720";
    this.Header = function (value) {
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.HeaderChangingInternal(this, _Header, value);
        var cont = true;
        for (var i in this._HeaderChangingSubscribers) {
            cont = i(this, _Header, value);
        }
        if (cont) {
            _Header = value;
            this.HeaderChangedInternal(this, _Header, value);
            for (var i in this._HeaderChangedSubscribers) {
                i(this, _Header, value);
            }
        }
    }

    this.FooterChangingInternal = function (sender, oldVal, newVal) { }
    var _FooterChangingSubscribers = new Array();
    this.AddFooterChangingSubscriber = function (fun) { this._FooterChangingSubscribers.push(fun); }
    this.RemoveFooterChangingSubscriber = function (fun) { this._FooterChangingSubscribers.pop(fun); }
    this.FooterChangedInternal = function (sender, oldVal, newVal) { }
    var _FooterChangedSubscribers = new Array();
    this.AddFooterChangedSubscriber = function (fun) { this._FooterChangedSubscribers.push(fun); }
    this.RemoveFooterChangedSubscriber = function (fun) { this._FooterChangedSubscribers.pop(fun); }


    var _Footer = "720";
    this.Footer = function (value) {
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.FooterChangingInternal(this, _Footer, value);
        var cont = true;
        for (var i in this._FooterChangingSubscribers) {
            cont = i(this, _Footer, value);
        }
        if (cont) {
            _Footer = value;
            this.FooterChangedInternal(this, _Footer, value);
            for (var i in this._FooterChangedSubscribers) {
                i(this, _Footer, value);
            }
        }
    }

    this.GutterChangingInternal = function (sender, oldVal, newVal) { }
    var _GutterChangingSubscribers = new Array();
    this.AddGutterChangingSubscriber = function (fun) { this._GutterChangingSubscribers.push(fun); }
    this.RemoveGutterChangingSubscriber = function (fun) { this._GutterChangingSubscribers.pop(fun); }
    this.GutterChangedInternal = function (sender, oldVal, newVal) { }
    var _GutterChangedSubscribers = new Array();
    this.AddGutterChangedSubscriber = function (fun) { this._GutterChangedSubscribers.push(fun); }
    this.RemoveGutterChangedSubscriber = function (fun) { this._GutterChangedSubscribers.pop(fun); }

    var _Gutter = "0";
    this.Gutter = function (value) {
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.GutterChangingInternal(this, _Gutter, value);
        var cont = true;
        for (var i in this._GutterChangingSubscribers) {
            cont = i(this, _Gutter, value);
        }
        if (cont) {
            _Gutter = value;
            this.GutterChangedInternal(this, _Gutter, value);
            for (var i in this._GutterChangedSubscribers) {
                i(this, _Gutter, value);
            }
        }
    }
}

function WML_CT_Page() {
    this.Classname = function () { return "WML_CT_Page" };

    var _Paragraphs = new Array();
    this.Paragraphs = function (action, value) {
        if (action == "add") {
            if (value.Classname() != "WML_CT_P") { throw "" }
            _Paragraphs.push(value);
        }
        if (action == "get") {
            return _Paragraphs[value];
        }
    }

    var _PageNumber = 1;
    this.PageNumber = function (value) {
        if (value == null) {
            return _PageNumber;
        }
    }
    
    var _Sections = new Array();
    this.Sections = function (action, value) {
        if (action == "add") {
            if (value.Classname() != "WML_CT_P") { throw "" }
            _Sections.push(value);
        }
        if (action == "get") {
            return _Sections[value];
        }
    }
    
    var _StartPosition = 1;
    this.StartPosition = function (value) {
        if (value == null) {
            return _StartPosition;
        }
    }

    var _StartRun = null;
    this.StartRun = function (value) {
        if (value == null) {
            return _StartRun;
        }
    }

    var _EndPosition = 1;
    this.EndPosition = function (value) {
        if (value == null) {
            return _EndPosition;
        }
    }

    var _EndRun = null;
    this.EndRun = function (value) {
        if (value == null) {
            return _EndRun;
        }
    }

    var _IsVisible = false;
    this.IsVisible = function (value) {
        if (value == null) {
            return _IsVisible;
        }
    }

    var _Top = false;
    this.Top = function (value) {
        if (value == null) {
            return _Top;
        }
    }

    var _Left = false;
    this.Left = function (value) {
        if (value == null) {
            return _Left;
        }
    }

    var _Bottom = false;
    this.Bottom = function (value) {
        if (value == null) {
            return _Bottom;
        }
    }

    var _Right = false;
    this.Right = function (value) {
        if (value == null) {
            return _Right;
        }
    }

    this._Div = $("<div style='position:absolute;height:0px;width:0px;overflow:hidden;'/>");

    var _Divs = new Array();
    this.Divs = function (action, value) {
        if (action == "getAll") {
            return _Divs;
        }
    }
}
function WML_CT_P() {
    this.Classname = function () { return "WML_CT_P" };

    var _Children = new Array();
    this.Children = function (action, value) {
        if (action == "add") {
            if (value.Classname() == "WML_CT_Bookmark" ||
                value.Classname() == "WML_CT_MarkupRange" ||
                value.Classname() == "WML_CT_R"
                ) { } else { throw "" }
            _Children.push(value);
        }
        if (action == "all") {
            return _Children;
        }
    }


    this.RsidRChangingInternal = function (sender, oldVal, newVal) { }
    var _RsidRChangingSubscribers = new Array();
    this.AddRsidRChangingSubscriber = function (fun) { this._RsidRChangingSubscribers.push(fun); }
    this.RemoveRsidRChangingSubscriber = function (fun) { this._RsidRChangingSubscribers.pop(fun); }
    this.RsidRChangedInternal = function (sender, oldVal, newVal) { }
    var _RsidRChangedSubscribers = new Array();
    this.AddRsidRChangedSubscriber = function (fun) { this._RsidRChangedSubscribers.push(fun); }
    this.RemoveRsidRChangedSubscriber = function (fun) { this._RsidRChangedSubscribers.pop(fun); }

    var _RsidR = "";
    this.RsidR = function (value) {
        if (value == null) {
            return _RsidR;
        }
        else {
            if (!value.toString().match(/[0-9]*/)) { throw "" }
            this.RsidRChangingInternal(this, _RsidR, value);
            var cont = true;
            for (var i in _RsidRChangingSubscribers) {
                cont = i(this, _RsidR, value);
            }
            if (cont) {
                _RsidR = value;
                this.RsidRChangedInternal(this, _RsidR, value);
                for (var i in this._RsidRChangedSubscribers) {
                    i(this, _RsidR, value);
                }
            }
        }
    }

    this.RsidRDefaultChangingInternal = function (sender, oldVal, newVal) { }
    var _RsidRDefaultChangingSubscribers = new Array();
    this.AddRsidRDefaultChangingSubscriber = function (fun) { this._RsidRDefaultChangingSubscribers.push(fun); }
    this.RemoveRsidRDefaultChangingSubscriber = function (fun) { this._RsidRDefaultChangingSubscribers.pop(fun); }
    this.RsidRDefaultChangedInternal = function (sender, oldVal, newVal) { }
    var _RsidRDefaultChangedSubscribers = new Array();
    this.AddRsidRDefaultChangedSubscriber = function (fun) { this._RsidRDefaultChangedSubscribers.push(fun); }
    this.RemoveRsidRDefaultChangedSubscriber = function (fun) { this._RsidRDefaultChangedSubscribers.pop(fun); }
    var _rsRsidRDefaultRDefault = null;

    var _RsidRDefault = "";
    this.RsidRDefault = function (value) {
        if (value == null) {
            return _RsidRDefault;
        }
        else {
            if (!value.toString().match(/[0-9]*/)) { throw "" }
            this.RsidRDefaultChangingInternal(this, _RsidRDefault, value);
            var cont = true;
            for (var i in _RsidRDefaultChangingSubscribers) {
                cont = i(this, _RsidRDefault, value);
            }
            if (cont) {
                _RsidRDefault = value;
                this.RsidRDefaultChangedInternal(this, _RsidRDefault, value);
                for (var i in this._RsidRDefaultChangedSubscribers) {
                    i(this, _RsidRDefault, value);
                }
            }
        }
    }

    this.pPr = null;
    this.fldSimple = new WML_CT_SimpleField();
}

function WML_CT_SimpleField() {
    this.instr = "";
    this.fldLock = false;
    this.dirty = false;
}

function WML_CT_R() {
    this.Classname = function () { return "WML_CT_R" };
    this.rPr = new WML_CT_RPR();
    this.t = "";
    this.Spans = new Array();
}

function WML_CT_RPR() {
    this.rStyle = "";
    this.rFonts = new WML_CT_Fonts();
    this.b = false;
    this.bCs = false;
    this.i = false;
    this.iCs = false;
    this.caps = false;
    this.smallCaps = false;
    this.strike = false;
    this.dstrike = false;
    this.outline = false;
    this.shadow = false;
    this.emboss = false;
    this.imprint = false;
    this.noProof = false;
    this.snapToGrid = false;
    this.vanish = false;
    this.webHidden = false;
    this.color = new WML_CT_Color();
    this.spacing = "";
    this.w = "";
    this.kern = "";
    this.position = "";
    this.sz = "";
    this.szCs = "";
    this.highlight = "";
    this.u = "";
    this.effect = "";
    this.bdr = new WML_CT_Border();
    this.shd = new WML_CT_Shd();
    this.fitText = new WML_CT_FitText();
    this.vertAlign = "";
    this.rtl = false;
    this.cs = false;
    this.em = "";
    this.lang = new WML_CT_Language();
    this.eastAsianLayout = new WML_CT_EastAsianLayout();
    this.specVanish = false;
    this.oMath = false;
}

function WML_CT_FitText() {
    this.id = "";
    this.value = "";
}

function WML_CT_Bookmark() {
    this.Classname = function () { return "WML_CT_Bookmark" };

    this.IdChangingInternal = function (sender, oldVal, newVal) { }
    var _IdChangingSubscribers = new Array();
    this.AddIdChangingSubscriber = function (fun) { this._IdChangingSubscribers.push(fun); }
    this.RemoveIdChangingSubscriber = function (fun) { this._IdChangingSubscribers.pop(fun); }
    this.IdChangedInternal = function (sender, oldVal, newVal) { }
    var _IdChangedSubscribers = new Array();
    this.AddIdChangedSubscriber = function (fun) { this._IdChangedSubscribers.push(fun); }
    this.RemoveIdChangedSubscriber = function (fun) { this._IdChangedSubscribers.pop(fun); }


    var _Id = "";
    this.Id = function (value) {
        if (value == null) {
            return _Id;
        }
        else {
            if (!value.toString().match(/[0-9]*/)) { throw "" }
            this.IdChangingInternal(this, _Id, value);
            var cont = true;
            for (var i in _IdChangingSubscribers) {
                cont = i(this, _Id, value);
            }
            if (cont) {
                _Id = value;
                this.IdChangedInternal(this, _Id, value);
                for (var i in this._IdChangedSubscribers) {
                    i(this, _Id, value);
                }
            }
        }
    }

    this.NameChangingInternal = function (sender, oldVal, newVal) { }
    var _NameChangingSubscribers = new Array();
    this.AddNameChangingSubscriber = function (fun) { this._NameChangingSubscribers.push(fun); }
    this.RemoveNameChangingSubscriber = function (fun) { this._NameChangingSubscribers.pop(fun); }
    this.NameChangedInternal = function (sender, oldVal, newVal) { }
    var _NameChangedSubscribers = new Array();
    this.AddNameChangedSubscriber = function (fun) { this._NameChangedSubscribers.push(fun); }
    this.RemoveNameChangedSubscriber = function (fun) { this._NameChangedSubscribers.pop(fun); }

    var _Name = "";
    this.Name = function (value) {
        if (value == null) {
            return _Name;
        }
        else {
            this.NameChangingInternal(this, _Name, value);
            var cont = true;
            for (var i in _NameChangingSubscribers) {
                cont = i(this, _Name, value);
            }
            if (cont) {
                _Name = value;
                this.NameChangedInternal(this, _Name, value);
                for (var i in this._NameChangedSubscribers) {
                    i(this, _Name, value);
                }
            }
        }
    }
}

function WML_CT_MarkupRange() {
    this.Classname = function () { return "WML_CT_MarkupRange" };

    this.IdChangingInternal = function (sender, oldVal, newVal) { }
    var _IdChangingSubscribers = new Array();
    this.AddIdChangingSubscriber = function (fun) { this._IdChangingSubscribers.push(fun); }
    this.RemoveIdChangingSubscriber = function (fun) { this._IdChangingSubscribers.pop(fun); }
    this.IdChangedInternal = function (sender, oldVal, newVal) { }
    var _IdChangedSubscribers = new Array();
    this.AddIdChangedSubscriber = function (fun) { this._IdChangedSubscribers.push(fun); }
    this.RemoveIdChangedSubscriber = function (fun) { this._IdChangedSubscribers.pop(fun); }

    var _Id = "";
    this.Id = function (value) {
        if (value == null) {
            return _Id;
        }
        else {
            if (!value.toString().match(/[0-9]*/)) { throw "" }
            this.IdChangingInternal(this, _Id, value);
            var cont = true;
            for (var i in _IdChangingSubscribers) {
                cont = i(this, _Id, value);
            }
            if (cont) {
                _Id = value;
                this.IdChangedInternal(this, _Id, value);
                for (var i in this._IdChangedSubscribers) {
                    i(this, _Id, value);
                }
            }
        }
    }
}

function WML_CT_Document() {
    this.Classname = function () { return "WML_CT_Document" };

    this.BackgroundChangingInternal = function (sender, oldVal, newVal) { }
    var _BackgroundChangingSubscribers = new Array();
    this.AddBackgroundChangingSubscriber = function (fun) { this._BackgroundChangingSubscribers.push(fun); }
    this.RemoveBackgroundChangingSubscriber = function (fun) { this._BackgroundChangingSubscribers.pop(fun); }
    this.BackgroundChangedInternal = function (sender, oldVal, newVal) { }
    var _BackgroundChangedSubscribers = new Array();
    this.AddBackgroundChangedSubscriber = function (fun) { this._BackgroundChangedSubscribers.push(fun); }
    this.RemoveBackgroundChangedSubscriber = function (fun) { this._BackgroundChangedSubscribers.pop(fun); }

    var _Background = null;
    this.Background = function (value) {
        if (value == null) {
            return _Background;
        }
        else {
            if (value.Classname() != "WML_CT_Background") { throw "" }
            this.BackgroundChangingInternal(this, _Background, value);
            var cont = true;
            for (var i in _BackgroundChangingSubscribers) {
                cont = i(this, _Background, value);
            }
            if (cont) {
                _Background = value;
                this.BackgroundChangedInternal(this, _Background, value);
                for (var i in this._BackgroundChangedSubscribers) {
                    i(this, _Background, value);
                }
            }
        }
    }

    this.BodyChangingInternal = function (sender, oldVal, newVal) { }
    _BodyChangingSubscribers = new Array();
    this.AddBodyChangingSubscriber = function (fun) { this._BodyChangingSubscribers.push(fun); }
    this.RemoveBodyChangingSubscriber = function (fun) { this._BodyChangingSubscribers.pop(fun); }
    this.BodyChangedInternal = function (sender, oldVal, newVal) { }
    _BodyChangedSubscribers = new Array();
    this.AddBodyChangedSubscriber = function (fun) { this._BodyChangedSubscribers.push(fun); }
    this.RemoveBodyChangedSubscriber = function (fun) { this._BodyChangedSubscribers.pop(fun); }

    var _Body = new WML_CT_Body();
    this.Body = function (value) {
        if (value == null) {
            return _Body;
        }
        else {
            if (value.Classname() != "WML_CT_Body") { throw "" }
            this.BodyChangingInternal(this, _Body, value);
            var cont = true;
            for (var i in _BodyChangingSubscribers) {
                cont = i(this, _Body, value);
            }
            if (cont) {
                _Body = value;
                this.BodyChangedInternal(this, _Body, value);
                for (var i in this._BodyChangedSubscribers) {
                    i(this, _Body, value);
                }
            }
        }
    }
}

function WML_CT_framePr() {
    this.dropCap = "";
    this.lines = 0;
    this.w = "";
    this.h = "";
    this.vSpace = "";
    this.hSpace = "";
    this.wrap = "";
    this.hAnchor = "";
    this.vAnchor = "";
    this.x = "";
    this.xAlign = "";
    this.y = "";
    this.yAlign = "";
    this.hRule = "";
    this.anchorLock = false;
}

function WML_CT_TrackChange() {
    this.Id = 0;
    this.Date = "";
    this.Author = "";
}

function WML_CT_NumPr() {
    this.ilvl = 0;
    this.numId = 0;
    this.ins = new WML_CT_TrackChange();
}

function WML_CT_Border() {
    this.val = "";
    this.color = "";
    this.themeColor = "";
    this.themeTint = 0;
    this.themeShade = 0;
    this.sz = 0;
    this.space = 0;
    this.shadow = false;
    this.frame = false;
}

function WML_CT_PBdr() {
    this.top = new WML_CT_Border();
    this.left = new WML_CT_Border();
    this.bottom = new WML_CT_Border();
    this.right = new WML_CT_Border();
    this.between = new WML_CT_Border();
    this.bar = new WML_CT_Border();
}

function WML_CT_Spacing() {
    this.before = "";
    this.beforeLines = "";
    this.beforeAutospacing = "";
    this.after = "";
    this.afterLines = "";
    this.afterAutospacing = "";
    this.line = "";
    this.lineRule = "";
}

function WML_CT_PPrGeneral() {
    this.pStyle = "";
    this.keepNext = false;
    this.keepLines = false;
    this.pageBreakBefore = false;
    this.framePr = WML_CT_framePr();
    this.widowControl = false;
    this.numPr = new WML_CT_NumPr();
    this.suppressLineNumbers = false;
    this.suppressAutoHyphens = false;
    this.pBdr = new WML_CT_PBdr();
    this.shd = new WML_CT_Shd();
    var _Tabs = new Array();
    this.Tabs = function (action, value) {
        if (action == "get") {
            return _Tabs[value];
        }
    }
    this.kinsoku = false;
    this.wordWrap = false;
    this.overflowPunct = false;
    this.topLinePunct = false;
    this.autoSpaceDE = false;
    this.autoSpaceDN = false;
    this.bidi = false;
    this.adjustRightInd = false;
    this.snapToGrid = false;
    this.spacing = new WML_CT_Spacing();
    this.ind = new WML_CT_Ind();
    this.contextualSpacing = false;
    this.mirrorIndents = false;
    this.suppressOverlap = false;
    this.jc = "";
    this.textDirection = "";
    this.textAlignment = "";
    this.textboxTightWrap = "";
    this.outlineLvl = 0;
    this.divId = 0;
    this.cnfStyle = new WML_CT_Cnf();
}

function WML_CT_PPr() {
    this.Classname = "WML_CT_PPr";
    this.SectPr = null;
    this.pPrChange = null;

    this.pStyle = "";
    this.keepNext = false;
    this.keepLines = false;
    this.pageBreakBefore = false;
    this.framePr = WML_CT_framePr();
    this.widowControl = false;
    this.numPr = new WML_CT_NumPr();
    this.suppressLineNumbers = false;
    this.suppressAutoHyphens = false;
    this.kinsoku = false;
    this.wordWrap = false;
    this.overflowPunct = false;
    this.topLinePunct = false;
    this.autoSpaceDE = false;
    this.autoSpaceDN = false;
    this.bidi = false;
    this.adjustRightInd = false;
    this.snapToGrid = false;
    this.contextualSpacing = false;
    this.mirrorIndents = false;
    this.suppressOverlap = false;

    this.pBdr = new WML_CT_PBdr();
    this.shd = new WML_CT_Shd();
    var _Tabs = new Array();
    this.Tabs = function (action, value) {
        if (action == "get") {
            return _Tabs[value];
        }
    }
    this.spacing = new WML_CT_Spacing();
    this.ind = new WML_CT_Ind();
    this.jc = "";
    this.textDirection = "";
    this.textAlignment = "";
    this.textboxTightWrap = "";
    this.outlineLvl = 0;
    this.divId = 0;
    this.cnfStyle = new WML_CT_Cnf();
}

function WML_CT_Cnf() {
    this.firstRow = false;
    this.lastRow = false;
    this.firstColumn = false;
    this.lastColumn = false;
    this.oddVBand = false;
    this.evenVBand = false;
    this.oddHBand = false;
    this.evenHBand = false;
    this.firstRowFirstColumn = false;
    this.firstRowLastColumn = false;
    this.lastRowFirstColumn = false;
    this.lastRowLastColumn = false;
}

function WML_CT_Ind() {
    this.start = "";
    this.startChars = "";
    this.end = "";
    this.endChars = "";
    this.hanging = "";
    this.hangingChars = "";
    this.firstLine = "";
    this.firstLineChars = "";
}

function WML_CT_Shd() {
    this.val = "";
    this.color = "";
    this.themeColor = "";
    this.themeTint = "";
    this.themeShade = "";
    this.fill = "";
    this.themeFill = "";
    this.themeFillTin = "";
    this.themeFillShade = "";
}

function WML_CT_Body() {
    this.Classname = function () { return "WML_CT_Body" };

    var _P = new Array();
    this.P = function (action, value) {
        if (action == "add") {
            if (value.Classname() != "WML_CT_P") { throw "" }
            _P.push(value);
        }
        if (action == "all") {
            return _P;
        }
    }

    this.SectPrChangingInternal = function (sender, oldVal, newVal) { }
    var _SectPrChangingSubscribers = new Array();
    this.AddSectPrChangingSubscriber = function (fun) { this._SectPrChangingSubscribers.push(fun); }
    this.RemoveSectPrChangingSubscriber = function (fun) { this._SectPrChangingSubscribers.pop(fun); }
    this.SectPrChangedInternal = function (sender, oldVal, newVal) { }
    var _SectPrChangedSubscribers = new Array();
    this.AddSectPrChangedSubscriber = function (fun) { this._SectPrChangedSubscribers.push(fun); }
    this.RemoveSectPrChangedSubscriber = function (fun) { this._SectPrChangedSubscribers.pop(fun); }

    var _SectPr = new WML_CT_SectPr(this);
    this.SectPr = function (value) {
        if (value == null) {
            return _SectPr;
        }
        if (value.Classname() != "WML_CT_SectPr") { throw "" }
        this.SectPrChangingInternal(this, _SectPr, value);
        var cont = true;
        for (var i in _SectPrChangingSubscribers) {
            cont = i(this, _SectPr, value);
        }
        if (cont) {
            _SectPr = value;
            this.SectPrChangedInternal(this, _SectPr, value);
            for (var i in this._SectPrChangedSubscribers) {
                i(this, _SectPr, value);
            }
        }
    }

    _P.push(new WML_CT_P());
}

function WML_CT_SectPr() {
    this.Classname = function () { return "WML_CT_SectPr" };

    this.RsidRChangingInternal = function (sender, oldVal, newVal) { }
    var _RsidRChangingSubscribers = new Array();
    this.AddRsidRChangingSubscriber = function (fun) { this._RsidRChangingSubscribers.push(fun); }
    this.RemoveRsidRChangingSubscriber = function (fun) { this._RsidRChangingSubscribers.pop(fun); }
    this.RsidRChangedInternal = function (sender, oldVal, newVal) { }
    var _RsidRChangedSubscribers = new Array();
    this.AddRsidRChangedSubscriber = function (fun) { this._RsidRChangedSubscribers.push(fun); }
    this.RemoveRsidRChangedSubscriber = function (fun) { this._RsidRChangedSubscribers.pop(fun); }
    var _rsRsidRRDefault = null;

    var _RsidR = "";
    this.RsidR = function (value) {
        if (value == null) {
            return _RsidR;
        }
        else {
            if (!value.toString().match(/[0-9]*/)) { throw "" }
            this.RsidRChangingInternal(this, _RsidR, value);
            var cont = true;
            for (var i in _RsidRChangingSubscribers) {
                cont = i(this, _RsidR, value);
            }
            if (cont) {
                _RsidR = value;
                this.RsidRChangedInternal(this, _RsidR, value);
                for (var i in this._RsidRChangedSubscribers) {
                    i(this, _RsidR, value);
                }
            }
        }
    }

    this.PgSzChangingInternal = function (sender, oldVal, newVal) { }
    var _PgSzChangingSubscribers = new Array();
    this.AddPgSzChangingSubscriber = function (fun) { this._PgSzChangingSubscribers.push(fun); }
    this.RemovePgSzChangingSubscriber = function (fun) { this._PgSzChangingSubscribers.pop(fun); }
    this.PgSzChangedInternal = function (sender, oldVal, newVal) { }
    var _PgSzChangedSubscribers = new Array();
    this.AddPgSzChangedSubscriber = function (fun) { this._PgSzChangedSubscribers.push(fun); }
    this.RemovePgSzChangedSubscriber = function (fun) { this._PgSzChangedSubscribers.pop(fun); }


    var _PgSz = new WML_CT_PgSz(this);

    this.PgSz = function (value) {
        if (value == null) {
            return _PgSz;
        }
        if (value.Classname() != "WML_CT_PgSz") { throw "" }
        this.PgSzChangingInternal(this, _PgSz, value);
        var cont = true;
        for (var i in _PgSzChangingSubscribers) {
            cont = i(this, _PgSz, value);
        }
        if (cont) {
            _PgSz = value;
            this.PgSzChangedInternal(this, _PgSz, value);
            for (var i in this._PgSzChangedSubscribers) {
                i(this, _PgSz, value);
            }
        }
    }

    this.PgMarChangingInternal = function (sender, oldVal, newVal) { }
    var _PgMarChangingSubscribers = new Array();
    this.AddPgMarChangingSubscriber = function (fun) { this._PgMarChangingSubscribers.push(fun); }
    this.RemovePgMarChangingSubscriber = function (fun) { this._PgMarChangingSubscribers.pop(fun); }
    this.PgMarChangedInternal = function (sender, oldVal, newVal) { }
    var _PgMarChangedSubscribers = new Array();
    this.AddPgMarChangedSubscriber = function (fun) { this._PgMarChangedSubscribers.push(fun); }
    this.RemovePgMarChangedSubscriber = function (fun) { this._PgMarChangedSubscribers.pop(fun); }


    var _PgMar = new WML_CT_PageMar(this);
    this.PgMar = function () { return _PgMar; }
    this.PgMar = function (value) {
        if (value == null) {
            return _PgMar;
        }
        if (value.Classname() != "WML_CT_PageMar") { throw "" }
        this.PgMarChangingInternal(this, _PgMar, value);
        var cont = true;
        for (var i in _PgMarChangingSubscribers) {
            cont = i(this, _PgMar, value);
        }
        if (cont) {
            _PgMar = value;
            this.PgMarChangedInternal(this, _PgMar, value);
            for (var i in this._PgMarChangedSubscribers) {
                i(this, _PgMar, value);
            }
        }
    }

    this.ColsChangingInternal = function (sender, oldVal, newVal) { }
    var _ColsChangingSubscribers = new Array();
    this.AddColsChangingSubscriber = function (fun) { this._ColsChangingSubscribers.push(fun); }
    this.RemoveColsChangingSubscriber = function (fun) { this._ColsChangingSubscribers.pop(fun); }
    this.ColsChangedInternal = function (sender, oldVal, newVal) { }
    var _ColsChangedSubscribers = new Array();
    this.AddColsChangedSubscriber = function (fun) { this._ColsChangedSubscribers.push(fun); }
    this.RemoveColsChangedSubscriber = function (fun) { this._ColsChangedSubscribers.pop(fun); }

    var _Cols = new WML_CT_Columns();
    this.Cols = function (value) {
        if (value == null) {
            return _Cols;
        }
        else {
            if (value.Classname() != "WML_CT_Columns") { throw "" }
            this.ColsChangingInternal(this, _Cols, value);
            var cont = true;
            for (var i in _ColsChangingSubscribers) {
                cont = i(this, _Cols, value);
            }
            if (cont) {
                _Cols = value;
                this.ColsChangedInternal(this, _Cols, value);
                for (var i in this._ColsChangedSubscribers) {
                    i(this, _Cols, value);
                }
            }
        }
    }

    this.DocGridChangingInternal = function (sender, oldVal, newVal) { }
    var _DocGridChangingSubscribers = new Array();
    this.AddDocGridChangingSubscriber = function (fun) { this._DocGridChangingSubscribers.push(fun); }
    this.RemoveDocGridChangingSubscriber = function (fun) { this._DocGridChangingSubscribers.pop(fun); }
    this.DocGridChangedInternal = function (sender, oldVal, newVal) { }
    var _DocGridChangedSubscribers = new Array();
    this.AddDocGridChangedSubscriber = function (fun) { this._DocGridChangedSubscribers.push(fun); }
    this.RemoveDocGridChangedSubscriber = function (fun) { this._DocGridChangedSubscribers.pop(fun); }

    var _DocGrid = new WML_CT_DocGrid();
    this.DocGrid = function (value) {
        if (value == null) {
            return _DocGrid;
        }
        else {
            if (value.Classname() != "WML_CT_DocGrid") { throw "" }
            this.DocGridChangingInternal(this, _DocGrid, value);
            var cont = true;
            for (var i in _DocGridChangingSubscribers) {
                cont = i(this, _DocGrid, value);
            }
            if (cont) {
                _DocGrid = value;
                this.DocGridChangedInternal(this, _DocGrid, value);
                for (var i in this._DocGridChangedSubscribers) {
                    i(this, _DocGrid, value);
                }
            }
        }
    }
}
function WML_CT_Columns() {
    this.Classname = function () { return "WML_CT_Columns" };

    this.SpaceChangingInternal = function (sender, oldVal, newVal) { }
    var _SpaceChangingSubscribers = new Array();
    this.AddSpaceChangingSubscriber = function (fun) { this._SpaceChangingSubscribers.push(fun); }
    this.RemoveSpaceChangingSubscriber = function (fun) { this._SpaceChangingSubscribers.pop(fun); }
    this.SpaceChangedInternal = function (sender, oldVal, newVal) { }
    var _SpaceChangedSubscribers = new Array();
    this.AddSpaceChangedSubscriber = function (fun) { this._SpaceChangedSubscribers.push(fun); }
    this.RemoveSpaceChangedSubscriber = function (fun) { this._SpaceChangedSubscribers.pop(fun); }

    var _Space = "720";
    this.Space = function () { return _Space; }
    this.Space = function (value) {
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.SpaceChangingInternal(this, _Space, value);
        var cont = true;
        for (var i in this._SpaceChangingSubscribers) {
            cont = i(this, _Space, value);
        }
        if (cont) {
            _Space = value;
            this.SpaceChangedInternal(this, _Space, value);
            for (var i in this._SpaceChangedSubscribers) {
                i(this, _Space, value);
            }
        }
    }
}
function WML_CT_DocGrid() {
    this.Classname = function () { return "WML_CT_DocGrid" };

    this.LinePitchChangingInternal = function (sender, oldVal, newVal) { }
    var _LinePitchChangingSubscribers = new Array();
    this.AddLinePitchChangingSubscriber = function (fun) { this._LinePitchChangingSubscribers.push(fun); }
    this.RemoveLinePitchChangingSubscriber = function (fun) { this._LinePitchChangingSubscribers.pop(fun); }
    this.LinePitchChangedInternal = function (sender, oldVal, newVal) { }
    var _LinePitchChangedSubscribers = new Array();
    this.AddLinePitchChangedSubscriber = function (fun) { this._LinePitchChangedSubscribers.push(fun); }
    this.RemoveLinePitchChangedSubscriber = function (fun) { this._LinePitchChangedSubscribers.pop(fun); }

    var _LinePitch = "360";
    this.LinePitch = function () { return _LinePitch; }
    this.LinePitch = function (value) {
        if (!ST_TwipsMeasure.IsValid(value)) { throw "" }
        this.LinePitchChangingInternal(this, _LinePitch, value);
        var cont = true;
        for (var i in this._LinePitchChangingSubscribers) {
            cont = i(this, _LinePitch, value);
        }
        if (cont) {
            _LinePitch = value;
            this.LinePitchChangedInternal(this, _LinePitch, value);
            for (var i in this._LinePitchChangedSubscribers) {
                i(this, _LinePitch, value);
            }
        }
    }
}
function WML_CT_PgSz() {
    this.Classname = function () { return "WML_CT_PgSz" };

    this.WChangingInternal = function (sender, oldVal, newVal) { }
    var _WChangingSubscribers = new Array();
    this.AddWChangingSubscriber = function (fun) { this._WChangingSubscribers.push(fun); }
    this.RemoveWChangingSubscriber = function (fun) { this._WChangingSubscribers.pop(fun); }
    this.WChangedInternal = function (sender, oldVal, newVal) { }
    var _WChangedSubscribers = new Array();
    this.AddWChangedSubscriber = function (fun) { this._WChangedSubscribers.push(fun); }
    this.RemoveWChangedSubscriber = function (fun) { this._WChangedSubscribers.pop(fun); }

    var _W = "";
    this.W = function (value) {
        if (value == null) {
            return _W;
        }
        if (value.toString().match(/[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)|/) || (value > 0 && value <= 18446744073709551615)) { } else { throw "" }
        this.WChangingInternal(this, _W, value);
        var cont = true;
        for (var i in _WChangingSubscribers) {
            cont = i(this, _W, value);
        }
        if (cont) {
            _W = value;
            this.WChangedInternal(this, _W, value);
            for (var i in this._WChangedSubscribers) {
                i(this, _W, value);
            }
        }
    }

    this.HChangingInternal = function (sender, oldVal, newVal) { }
    var _HChangingSubscribers = new Array();
    this.AddHChangingSubscriber = function (fun) { this._HChangingSubscribers.push(fun); }
    this.RemoveHChangingSubscriber = function (fun) { this._HChangingSubscribers.pop(fun); }
    this.HChangedInternal = function (sender, oldVal, newVal) { }
    var _HChangedSubscribers = new Array();
    this.AddHChangedSubscriber = function (fun) { this._HChangedSubscribers.push(fun); }
    this.RemoveHChangedSubscriber = function (fun) { this._HChangedSubscribers.pop(fun); }

    var _H = "";
    this.H = function () { return _H; }
    this.H = function (value) {
        if (value == null) {
            return _H;
        }
        if (value.toString().match(/[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)|/) || (value > 0 && value <= 18446744073709551615)) { } else { throw "" }
        this.HChangingInternal(this, _H, value);
        var cont = true;
        for (var i in _HChangingSubscribers) {
            cont = i(this, _H, value);
        }
        if (cont) {
            _H = value;
            this.HChangedInternal(this, _H, value);
            for (var i in this._HChangedSubscribers) {
                i(this, _H, value);
            }
        }
    }

    this.OrientChangingInternal = function (sender, oldVal, newVal) { }
    var _OrientChangingSubscribers = new Array();
    this.AddOrientChangingSubscriber = function (fun) { this._OrientChangingSubscribers.push(fun); }
    this.RemoveOrientChangingSubscriber = function (fun) { this._OrientChangingSubscribers.pop(fun); }
    this.OrientChangedInternal = function (sender, oldVal, newVal) { }
    var _OrientChangedSubscribers = new Array();
    this.AddOrientChangedSubscriber = function (fun) { this._OrientChangedSubscribers.push(fun); }
    this.RemoveOrientChangedSubscriber = function (fun) { this._OrientChangedSubscribers.pop(fun); }

    var _Orient = "";
    this.Orient = function () { return _Orient; }
    this.Orient = function (value) {
        if (!value.toString().match(/portrait|landscape/)) { throw "" }
        this.OrientChangingInternal(this, _Orient, value);
        var cont = true;
        for (var i in _OrientChangingSubscribers) {
            cont = i(this, _Orient, value);
        }
        if (cont) {
            _Orient = value;
            this.OrientChangedInternal(this, _Orient, value);
            for (var i in this._OrientChangedSubscribers) {
                i(this, _Orient, value);
            }
        }
    }
}

function WML_CT_Background() {
    this.Classname = function () { return "WML_CT_Background" };

    this.ColorChangingInternal = function (sender, oldVal, newVal) { }
    var _ColorChangingSubscribers = new Array();
    this.AddColorChangingSubscriber = function (fun) { this._ColorChangingSubscribers.push(fun); }
    this.RemoveColorChangingSubscriber = function (fun) { this._ColorChangingSubscribers.pop(fun); }
    this.ColorChangedInternal = function (sender, oldVal, newVal) { }
    var _ColorChangedSubscribers = new Array();
    this.AddColorChangedSubscriber = function (fun) { this._ColorChangedSubscribers.push(fun); }
    this.RemoveColorChangedSubscriber = function (fun) { this._ColorChangedSubscribers.pop(fun); }

    var _Color = "FFFFFF";
    this.Color = function () { return _Color; }
    this.Color = function (value) {
        if (!value.toString().match(/auto|[A-Fa-f0-9]{6}/)) { throw "" }
        this.ColorChangingInternal(this, _Color, value);
        var cont = true;
        for (var i in this._ColorChangingSubscribers) {
            cont = i(this, _Color, value);
        }
        if (cont) {
            _Color = value;
            this.ColorChangedInternal(this, _Color, value);
            for (var i in this._ColorChangedSubscribers) {
                i(this, _Color, value);
            }
        }
    }
}

function WML() {
    this.Classname = function () { return "WML" };

    var _Pages = new Array();
    this.Pages = function (action, value) {
        if (action == "add") {
            if (value.Classname() != "WML_CT_Page") { throw "" }
            _Pages.push(value);
        }
        if (action == "get") {
            return _Pages[value];
        }
    }    

    this.DocumentChangingInternal = function (sender, oldVal, newVal) { }
    var _DocumentChangingSubscribers = new Array();
    this.AddDocumentChangingSubscriber = function (fun) { this._DocumentChangingSubscribers.push(fun); }
    this.RemoveDocumentChangingSubscriber = function (fun) { this._DocumentChangingSubscribers.pop(fun); }
    this.DocumentChangedInternal = function (sender, oldVal, newVal) { }
    var _DocumentChangedSubscribers = new Array();
    this.AddDocumentChangedSubscriber = function (fun) { this._DocumentChangedSubscribers.push(fun); }
    this.RemoveDocumentChangedSubscriber = function (fun) { this._DocumentChangedSubscribers.pop(fun); }

    var _Document = null;
    this.Document = function (value) {
        if (value == null) {
            return this._DocumentUrl;
        }
        if (value.Classname() != "WML_CT_Document") { throw "" }
        this.DocumentChangingInternal(this, _Document, value);
        var cont = true;
        for (var i in _DocumentChangingSubscribers) {
            cont = i(this, _Document, value);
        }
        if (cont) {
            _Document = value;
            this.DocumentChangedInternal(this, _Document, value);
            for (var i in this._DocumentChangedSubscribers) {
                i(this, _Document, value);
            }
        }
    }

    this.ShowMenuChangingInternal = function (sender, oldVal, newVal) { }
    var _ShowMenuChangingSubscribers = new Array();
    this.AddShowMenuChangingSubscriber = function (fun) { this._ShowMenuChangingSubscribers.push(fun); }
    this.RemoveShowMenuChangingSubscriber = function (fun) { this._ShowMenuChangingSubscribers.pop(fun); }
    this.ShowMenuChangedInternal = function (sender, oldVal, newVal) { }
    var _ShowMenuChangedSubscribers = new Array();
    this.AddShowMenuChangedSubscriber = function (fun) { this._ShowMenuChangedSubscribers.push(fun); }
    this.RemoveShowMenuChangedSubscriber = function (fun) { this._ShowMenuChangedSubscribers.pop(fun); }

    var _ShowMenu = "true";
    this.ShowMenu = function (value) {
        if (value == null) {
            return _ShowMenu;
        }
        if (!value.toString().match(/true|false/)) { throw "" }
        this.ShowMenuChangingInternal(this, _ShowMenu, value);
        var cont = true;
        for (var i in _ShowMenuChangingSubscribers) {
            cont = i(this, _ShowMenu, value);
        }
        if (cont) {
            _ShowMenu = value;
            this.ShowMenuChangedInternal(this, _ShowMenu, value);
            for (var i in this._ShowMenuChangedSubscribers) {
                i(this, _ShowMenu, value);
            }
        }
    }

    var _ShowTopBar = "true";
    this.ShowTopBar = function (value) {
        if (value == null) {
            return _ShowTopBar;
        }
        if (!value.toString().match(/true|false/)) { throw "" }
        this.ShowTopBarChangingInternal(this, _ShowTopBar, value);
        var cont = true;
        for (var i in _ShowTopBarChangingSubscribers) {
            cont = i(this, _ShowTopBar, value);
        }
        if (cont) {
            _ShowTopBar = value;
            this.ShowTopBarChangedInternal(this, _ShowTopBar, value);
            for (var i in this._ShowTopBarChangedSubscribers) {
                i(this, _ShowTopBar, value);
            }
        }
    }

    this.ShowRulersChangingInternal = function (sender, oldVal, newVal) { }
    var _ShowRulersChangingSubscribers = new Array();
    this.AddShowRulersChangingSubscriber = function (fun) { this._ShowRulersChangingSubscribers.push(fun); }
    this.RemoveShowRulersChangingSubscriber = function (fun) { this._ShowRulersChangingSubscribers.pop(fun); }
    this.ShowRulersChangedInternal = function (sender, oldVal, newVal) { }
    var _ShowRulersChangedSubscribers = new Array();
    this.AddShowRulersChangedSubscriber = function (fun) { this._ShowRulersChangedSubscribers.push(fun); }
    this.RemoveShowRulersChangedSubscriber = function (fun) { this._ShowRulersChangedSubscribers.pop(fun); }

    var _ShowRulers = "true";
    this.ShowRulers = function (value) {
        if (value == null) {
            return _ShowRulers;
        }
        if (!value.toString().match(/true|false/)) { throw "" }
        this.ShowRulersChangingInternal(this, _ShowRulers, value);
        var cont = true;
        for (var i in _ShowRulersChangingSubscribers) {
            cont = i(this, _ShowRulers, value);
        }
        if (cont) {
            _ShowRulers = value;
            this.ShowRulersChangedInternal(this, _ShowRulers, value);
            for (var i in this._ShowRulersChangedSubscribers) {
                i(this, _ShowRulers, value);
            }
        }
    }

    this.ParentWidthChangingInternal = function (sender, oldVal, newVal) { }
    var _ParentWidthChangingSubscribers = new Array();
    this.AddParentWidthChangingSubscriber = function (fun) { this._ParentWidthChangingSubscribers.push(fun); }
    this.RemoveParentWidthChangingSubscriber = function (fun) { this._ParentWidthChangingSubscribers.pop(fun); }
    this.ParentWidthChangedInternal = function (sender, oldVal, newVal) { }
    var _ParentWidthChangedSubscribers = new Array();
    this.AddParentWidthChangedSubscriber = function (fun) { this._ParentWidthChangedSubscribers.push(fun); }
    this.RemoveParentWidthChangedSubscriber = function (fun) { this._ParentWidthChangedSubscribers.pop(fun); }
    
    this.ParentWidth = function (value) {
        if (value == null) {
            return this._ParentWidth;
        }
    }
    
    this.ParentHeight = function (value) {
        if (value == null) {
            return this._ParentHeight;
        }
    }

    this._ParentDiv = null;
    this.ParentDiv = function (value) {
        if (value == null) {
            return this._ParentDiv;
        }
    }

    this.DPIChangingInternal = function (sender, oldVal, newVal) { }
    var _DPIChangingSubscribers = new Array();
    this.AddDPIChangingSubscriber = function (fun) { this._DPIChangingSubscribers.push(fun); }
    this.RemoveDPIChangingSubscriber = function (fun) { this._DPIChangingSubscribers.pop(fun); }
    this.DPIChangedInternal = function (sender, oldVal, newVal) { }
    var _DPIChangedSubscribers = new Array();
    this.AddDPIChangedSubscriber = function (fun) { this._DPIChangedSubscribers.push(fun); }
    this.RemoveDPIChangedSubscriber = function (fun) { this._DPIChangedSubscribers.pop(fun); }

    var _DPI = 96;
    this.DPI = function (value) {
        if (value == null) {
            return this._DPI;
        }
        if (value < 72 || value > 400) { throw "" }
        this.DPIChangingInternal(this, _DPI, value);
        var cont = true;
        for (var i in _DPIChangingSubscribers) {
            cont = i(this, _DPI, value);
        }
        if (cont) {
            _DPI = value;
            this.DPIChangedInternal(this, _DPI, value);
            for (var i in this._DPIChangedSubscribers) {
                i(this, _DPI, value);
            }
        }
    }

    this.DocumentUrlChangingInternal = function (sender, oldVal, newVal) { }
    var _DocumentUrlChangingSubscribers = new Array();
    this.AddDocumentUrlChangingSubscriber = function (fun) { this._DocumentUrlChangingSubscribers.push(fun); }
    this.RemoveDocumentUrlChangingSubscriber = function (fun) { this._DocumentUrlChangingSubscribers.pop(fun); }
    this.DocumentUrlChangedInternal = function (sender, oldVal, newVal) { }
    var _DocumentUrlChangedSubscribers = new Array();
    this.AddDocumentUrlChangedSubscriber = function (fun) { this._DocumentUrlChangedSubscribers.push(fun); }
    this.RemoveDocumentUrlChangedSubscriber = function (fun) { this._DocumentUrlChangedSubscribers.pop(fun); }

    var _DocumentUrl = "";
    this.DocumentUrl = function (value) {
        if (value == null) {
            return _DocumentUrl;
        }
        this.DocumentUrlChangingInternal(this, _DocumentUrl, value);
        var cont = true;
        for (var i in _DocumentUrlChangingSubscribers) {
            cont = i(this, _DocumentUrl, value);
        }
        if (cont) {
            _DocumentUrl = value;
            this.DocumentUrlChangedInternal(this, _DocumentUrl, value);
            for (var i in this._DocumentUrlChangedSubscribers) {
                i(this, _DocumentUrl, value);
            }
        }
    }   

    var _UniqueId = new Date().getTime();
    this.UniqueId = function () { return _UniqueId; }

    this._CursorDiv = $("<div style='position:absolute;height:0px;width:2px;border-left:1px solid black;overflow:hidden;'/>");
    this._CharacterWidths = new Object();
    
    this._TopBarHeight = 21;
    this._TopBarBorderThickness = 1;
    this._MenuHeight = 47;
    this._MenuBorderThickness = 1;
    this._RulerHeight = 10;
    this._SpaceAfterRibbon = 20;
    this._TimerInterval = 100;
    this._CursorTimerInterval = 500;
    this._CursorBlink = 0;    

    this.Selection = new WML_CT_Selection();
    this.CurrentStyle = new WML_CT_Style();
    this.Settings = new WML_CT_Settings();

    _Pages.push(new WML_CT_Page());
}